import moment from "moment"
export const setLs = (value, name) => {
  if (value) {
    const newValue = JSON.stringify(value)
    localStorage.setItem(name,newValue)
  }
}
export const getLs = (name) => {
  const item = localStorage.getItem(name)
  if (item) {
    return JSON.parse(item)
  } else {
    return ""
  }
}

// 转换时间戳精确到时分
export const getTimer = (value) => {
  return moment.unix(value).format('YYYY-MM-DD HH:mm')
}